
def widgets_tree(widget):
    """
    widgets_tree makes simpler to find children of a widget.
    It adds one attribute for each son using as name the name of son.
    """
    for name,child in [(x.name,x) for x in widget.get_children() if x.name]:
        if hasattr(widget,name):
            raise AttributeError,'attribute %s exists yet'%name
        setattr(widget,name,child)
        if hasattr(child,'get_children'):
            widgets_tree(child)
